#include "huffmantreewindow.h"
#include <QPainter>
#include <QScrollArea>
#include <QDebug>

// InputWeightsDialog implementation
InputWeightsDialog::InputWeightsDialog(QWidget *parent)
    : QDialog(parent)
{
    setWindowTitle("输入权重");
    setModal(true);
    resize(400, 120);

    QVBoxLayout *layout = new QVBoxLayout(this);

    QLabel *label = new QLabel("输入权重，用空格分隔 (如: 5 9 12 13 16 45):");
    layout->addWidget(label);

    weightsEdit = new QLineEdit();
    layout->addWidget(weightsEdit);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    layout->addWidget(buttonBox);

    connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
    connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
}

// EncodeDecodeDialog implementation
EncodeDecodeDialog::EncodeDecodeDialog(QWidget *parent, bool isEncode)
    : QDialog(parent)
{
    if (isEncode) {
        setWindowTitle("编码文本");
    } else {
        setWindowTitle("解码二进制串");
    }
    setModal(true);
    resize(400, 120);

    QVBoxLayout *layout = new QVBoxLayout(this);

    QLabel *label;
    if (isEncode) {
        label = new QLabel("要编码的文本:");
    } else {
        label = new QLabel("要解码的二进制串:");
    }
    layout->addWidget(label);

    inputEdit = new QLineEdit();
    layout->addWidget(inputEdit);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    layout->addWidget(buttonBox);

    connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
    connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
}

// HuffmanVisualizationWidget 构造函数
HuffmanVisualizationWidget::HuffmanVisualizationWidget(QWidget *parent)
    : QWidget(parent), root(nullptr), currentStep(0), totalSteps(0),
    isDragging(false), translation(0, 0), scale(1.0)
{
    setMouseTracking(true);
}

void HuffmanVisualizationWidget::resetView()
{
    translation = QPoint(0, 0);
    scale = 1.0;
    update();
}

void HuffmanVisualizationWidget::mousePressEvent(QMouseEvent* event)
{
    if (event->button() == Qt::LeftButton) {
        lastMousePos = event->pos();
        isDragging = true;
        setCursor(Qt::ClosedHandCursor);
    }
    QWidget::mousePressEvent(event);
}

void HuffmanVisualizationWidget::mouseMoveEvent(QMouseEvent* event)
{
    if (isDragging) {
        QPoint delta = event->pos() - lastMousePos;
        translation += delta;
        lastMousePos = event->pos();
        update();
    }
    QWidget::mouseMoveEvent(event);
}

void HuffmanVisualizationWidget::mouseReleaseEvent(QMouseEvent* event)
{
    if (event->button() == Qt::LeftButton) {
        isDragging = false;
        setCursor(Qt::ArrowCursor);
    }
    QWidget::mouseReleaseEvent(event);
}

void HuffmanVisualizationWidget::wheelEvent(QWheelEvent* event)
{
    // 支持缩放功能
    double zoomFactor = 1.1;
    if (event->angleDelta().y() > 0) {
        // 放大
        scale *= zoomFactor;
    } else {
        // 缩小
        scale /= zoomFactor;
    }
    scale = qMax(0.1, qMin(5.0, scale)); // 限制缩放范围
    update();

    QWidget::wheelEvent(event);
}

void HuffmanVisualizationWidget::paintEvent(QPaintEvent* event)
{
    Q_UNUSED(event);

    QPainter painter(this);
    painter.setRenderHint(QPainter::Antialiasing);
    painter.setPen(QPen(Qt::black, 2));

    QFont font = painter.font();
    font.setPointSize(8);
    painter.setFont(font);

    painter.fillRect(rect(), Qt::white);

    // 检查是否完全清空
    bool hasBuildSteps = !buildSteps.isEmpty() && currentStep < buildSteps.size();
    bool hasRoot = root != nullptr;

    if (!hasBuildSteps && !hasRoot) {
        painter.drawText(rect(), Qt::AlignCenter, "哈夫曼树为空\n请点击\"输入权重\"开始构建");
        return;
    }

    // 应用视图变换
    painter.save();
    painter.translate(translation);
    painter.scale(scale, scale);

    if (hasBuildSteps) {
        // 显示构建过程
        drawForest(painter, buildSteps[currentStep], currentStep);
    } else {
        // 显示最终树
        if (root == nullptr) {
            painter.restore(); // 恢复变换状态
            painter.drawText(rect(), Qt::AlignCenter, "哈夫曼树为空");
        } else {
            // 简单居中显示单棵树
            drawTree(painter, root, width() / 2, 50);
        }
    }

    painter.restore(); // 恢复变换状态

    // 在变换后绘制固定的UI元素（如提示信息）
    painter.setPen(Qt::black);
    if (hasBuildSteps || hasRoot) {
        painter.drawText(10, 20, "提示: 可以用鼠标拖动视图，滚轮缩放");
    }
}

void HuffmanVisualizationWidget::drawTree(QPainter& painter, HuffmanNode* node, int x, int y)
{
    if (node == nullptr) return;

    // 简单但有效的布局算法
    // 根据子树大小计算水平偏移
    int leftCount = countNodes(node->left);
    int rightCount = countNodes(node->right);

    // 计算偏移量，确保有足够空间
    int horizontalSpacing = 120; // 基础水平间距
    int verticalSpacing = 80;    // 垂直间距

    // 动态调整间距，避免重叠
    if (leftCount + rightCount > 4) {
        horizontalSpacing = 150;
    }
    if (leftCount + rightCount > 8) {
        horizontalSpacing = 200;
    }
    if (leftCount + rightCount > 12) {
        horizontalSpacing = 250;
    }

    if (node->left != nullptr) {
        int childX = x - horizontalSpacing;
        int childY = y + verticalSpacing;
        painter.drawLine(x, y + 25, childX, childY - 25);
        painter.drawText((x + childX) / 2 - 10, (y + childY) / 2, "0");
        drawTree(painter, node->left, childX, childY);
    }

    if (node->right != nullptr) {
        int childX = x + horizontalSpacing;
        int childY = y + verticalSpacing;
        painter.drawLine(x, y + 25, childX, childY - 25);
        painter.drawText((x + childX) / 2 - 10, (y + childY) / 2, "1");
        drawTree(painter, node->right, childX, childY);
    }

    painter.setBrush(QBrush(QColor(152, 251, 152)));
    painter.drawEllipse(x - 25, y - 25, 50, 50);
    painter.setPen(Qt::black);

    QString nodeText;
    if (node->character != '\0') {
        nodeText = QString("'%1'\n%2").arg(node->character).arg(node->weight);
    } else {
        nodeText = QString::number(node->weight);
    }

    painter.drawText(x - 20, y - 5, nodeText);
}

// 计算节点数量，用于确定布局
int HuffmanVisualizationWidget::countNodes(HuffmanNode* node)
{
    if (node == nullptr) return 0;
    return 1 + countNodes(node->left) + countNodes(node->right);
}

void HuffmanVisualizationWidget::drawForest(QPainter& painter, const QVector<HuffmanNode*>& forest, int step)
{
    // 显示步骤信息
    painter.setPen(Qt::black);
    painter.drawText(10, 60, QString("构建步骤: %1/%2").arg(step + 1).arg(totalSteps));

    if (step == 0) {
        painter.drawText(10, 80, "初始状态: 所有节点作为独立树");
    } else if (step < totalSteps - 1) {
        painter.drawText(10, 80, "合并两个权重最小的树");
    } else {
        painter.drawText(10, 80, "最终哈夫曼树");
    }

    // 计算每棵树的布局
    int treeCount = forest.size();
    if (treeCount == 0) return;

    // 简单布局：每棵树等分水平空间
    int treeWidth = width() / treeCount;
    int startY = 150;

    for (int i = 0; i < treeCount; ++i) {
        int x = i * treeWidth + treeWidth / 2;
        drawTree(painter, forest[i], x, startY);
    }
}

HuffmanTreeWindow::HuffmanTreeWindow(QWidget *parent)
    : QMainWindow(parent), m_root(nullptr), m_currentBuildStep(0)
{
    setupUI();
    updateDisplay();
    m_autoPlayTimer = new QTimer(this);
    connect(m_autoPlayTimer, &QTimer::timeout, this, &HuffmanTreeWindow::onNextStep);
}

HuffmanTreeWindow::~HuffmanTreeWindow()
{
    clearTree(m_root);
}

void HuffmanTreeWindow::setupUI()
{
    setWindowTitle("哈夫曼树可视化演示");
    setMinimumSize(1200, 800);
    resize(1200, 800);

    QWidget *centralWidget = new QWidget(this);
    setCentralWidget(centralWidget);

    QHBoxLayout *mainLayout = new QHBoxLayout(centralWidget);

    // 左侧可视化区域
    QVBoxLayout *leftLayout = new QVBoxLayout();
    leftLayout->setContentsMargins(0, 0, 0, 0);

    QLabel *visualLabel = new QLabel("哈夫曼树构建过程:");
    visualLabel->setStyleSheet("font-weight: bold; font-size: 14px;");
    leftLayout->addWidget(visualLabel);

    // 创建滚动区域来容纳可视化部件
    QScrollArea *scrollArea = new QScrollArea();
    scrollArea->setWidgetResizable(true);
    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

    m_visualizationWidget = new HuffmanVisualizationWidget();
    m_visualizationWidget->setMinimumSize(800, 750);
    scrollArea->setWidget(m_visualizationWidget);

    leftLayout->addWidget(scrollArea);

    mainLayout->addLayout(leftLayout, 4); // 左侧占4份空间

    // 右侧操作和信息区域
    QVBoxLayout *rightLayout = new QVBoxLayout();
    rightLayout->setContentsMargins(10, 0, 0, 0);

    // 返回按钮
    QPushButton *returnBtn = new QPushButton("返回主菜单");
    returnBtn->setStyleSheet("QPushButton { background-color: white; border: 1px solid #ccc; padding: 6px; font-size: 12px; }");
    rightLayout->addWidget(returnBtn);

    // 操作按钮区域
    QGroupBox *opsGroup = new QGroupBox("操作面板");
    opsGroup->setStyleSheet("QGroupBox { font-weight: bold; font-size: 12px; }");
    QGridLayout *opsLayout = new QGridLayout(opsGroup);

    // 设置按钮样式 - 白色背景，更紧凑
    QString buttonStyle = "QPushButton { text-align: center; padding: 6px; background-color: white; border: 1px solid #d0d0d0; font-size: 11px; min-height: 20px; }"
                          "QPushButton:hover { background-color: #f0f0f0; }";

    // 第一行按钮 - 输入权重
    QPushButton *inputWeightsBtn = new QPushButton("输入权重");
    inputWeightsBtn->setStyleSheet(buttonStyle);
    opsLayout->addWidget(inputWeightsBtn, 0, 0, 1, 2); // 跨两列

    // 第二行按钮 - 生成编码
    QPushButton *codesBtn = new QPushButton("生成编码");
    codesBtn->setStyleSheet(buttonStyle);
    opsLayout->addWidget(codesBtn, 1, 0, 1, 2); // 跨两列

    // 第三行按钮 - 编码和解码
    QPushButton *encodeBtn = new QPushButton("编码");
    encodeBtn->setStyleSheet(buttonStyle);
    opsLayout->addWidget(encodeBtn, 2, 0);

    QPushButton *decodeBtn = new QPushButton("解码");
    decodeBtn->setStyleSheet(buttonStyle);
    opsLayout->addWidget(decodeBtn, 2, 1);

    // 第四行按钮 - 构建过程控制
    m_prevStepBtn = new QPushButton("上一步");
    m_prevStepBtn->setStyleSheet(buttonStyle);
    opsLayout->addWidget(m_prevStepBtn, 3, 0);

    m_nextStepBtn = new QPushButton("下一步");
    m_nextStepBtn->setStyleSheet(buttonStyle);
    opsLayout->addWidget(m_nextStepBtn, 3, 1);

    // 第五行按钮 - 自动播放
    m_autoPlayBtn = new QPushButton("自动播放");
    m_autoPlayBtn->setStyleSheet(buttonStyle);
    opsLayout->addWidget(m_autoPlayBtn, 4, 0, 1, 2); // 跨两列

    // 第六行按钮 - 清空按钮
    QPushButton *clearBtn = new QPushButton("清空");
    clearBtn->setStyleSheet("QPushButton { text-align: center; padding: 6px; background-color: #ffcccc; border: 1px solid #ff9999; font-size: 11px; min-height: 20px; }"
                            "QPushButton:hover { background-color: #ffbbbb; }");
    opsLayout->addWidget(clearBtn, 5, 0, 1, 2); // 跨两列

    // 设置列比例，让按钮更紧凑
    opsLayout->setColumnStretch(0, 1);
    opsLayout->setColumnStretch(1, 1);
    opsLayout->setRowStretch(6, 1); // 最后一行拉伸填充空间

    // 设置操作面板的最大高度，使其更紧凑
    opsGroup->setMaximumHeight(300);

    rightLayout->addWidget(opsGroup);

    // 信息显示区域
    QGroupBox *infoGroup = new QGroupBox("哈夫曼树信息");
    infoGroup->setStyleSheet("QGroupBox { font-weight: bold; font-size: 12px; }");
    QVBoxLayout *infoLayout = new QVBoxLayout(infoGroup);

    m_display = new QTextEdit();
    m_display->setReadOnly(true);
    m_display->setMinimumHeight(300);
    m_display->setStyleSheet("font-size: 11px;"); // 设置字体大小
    infoLayout->addWidget(m_display);

    rightLayout->addWidget(infoGroup);

    mainLayout->addLayout(rightLayout, 1); // 右侧占1份空间

    // 连接信号槽
    connect(inputWeightsBtn, &QPushButton::clicked, this, &HuffmanTreeWindow::onInputWeights);
    connect(codesBtn, &QPushButton::clicked, this, &HuffmanTreeWindow::onGenerateCodes);
    connect(encodeBtn, &QPushButton::clicked, this, &HuffmanTreeWindow::onEncodeText);
    connect(decodeBtn, &QPushButton::clicked, this, &HuffmanTreeWindow::onDecodeText);
    connect(m_prevStepBtn, &QPushButton::clicked, this, &HuffmanTreeWindow::onPrevStep);
    connect(m_nextStepBtn, &QPushButton::clicked, this, &HuffmanTreeWindow::onNextStep);
    connect(m_autoPlayBtn, &QPushButton::clicked, this, &HuffmanTreeWindow::onAutoPlay);
    connect(clearBtn, &QPushButton::clicked, this, &HuffmanTreeWindow::onClear);
    connect(returnBtn, &QPushButton::clicked, this, &HuffmanTreeWindow::onReturnToMainMenu);
}

void HuffmanTreeWindow::onReturnToMainMenu()
{
    emit returnToMainMenu();
    this->close();
}

void HuffmanTreeWindow::updateDisplay()
{
    QString info;

    if (m_root == nullptr) {
        info = "哈夫曼树为空";
    } else {
        info = "字符频率:\n";
        for (int i = 0; i < m_frequencies.size(); ++i) {
            info += QString("'%1': %2\n").arg(m_frequencies[i].first).arg(m_frequencies[i].second);
        }

        info += "\n哈夫曼编码:\n";
        for (int i = 0; i < m_frequencies.size(); ++i) {
            char ch = m_frequencies[i].first;
            if (m_huffmanCodes.contains(ch)) {
                info += QString("'%1': %2\n").arg(ch).arg(m_huffmanCodes[ch]);
            }
        }
    }

    m_display->setText(info);

    // 更新构建过程显示
    if (!m_buildSteps.isEmpty()) {
        m_visualizationWidget->setBuildSteps(m_buildSteps);
        m_visualizationWidget->setCurrentStep(m_currentBuildStep);

        // 更新按钮状态
        m_prevStepBtn->setEnabled(m_currentBuildStep > 0);
        m_nextStepBtn->setEnabled(m_currentBuildStep < m_buildSteps.size() - 1);
        m_autoPlayBtn->setEnabled(m_buildSteps.size() > 1);
    } else {
        m_visualizationWidget->setRoot(m_root);
    }
}

void HuffmanTreeWindow::clearTree(HuffmanNode* node)
{
    if (node == nullptr) return;
    clearTree(node->left);
    clearTree(node->right);
    delete node;
}

void HuffmanTreeWindow::recordBuildStep(const SimpleVector<HuffmanNode*>& nodes)
{
    QVector<HuffmanNode*> step;
    for (int i = 0; i < nodes.size(); ++i) {
        step.append(nodes[i]);
    }
    m_buildSteps.append(step);
}

void HuffmanTreeWindow::buildHuffmanTree()
{
    if (m_frequencies.empty()) return;

    m_buildSteps.clear();
    m_currentBuildStep = 0;

    SimplePriorityQueue<HuffmanNode*, CompareHuffmanNode> pq;

    // 初始状态：所有节点作为独立树
    SimpleVector<HuffmanNode*> initialNodes;
    for (int i = 0; i < m_frequencies.size(); ++i) {
        HuffmanNode* node = new HuffmanNode(m_frequencies[i].second, m_frequencies[i].first);
        pq.push(node);
        initialNodes.push_back(node);
    }
    recordBuildStep(initialNodes);

    // 修复：当只有一个节点时，直接设为根节点
    if (pq.size() == 1) {
        m_root = pq.top();
        return;
    }

    while (pq.size() > 1) {
        // 取出两个权重最小的节点
        HuffmanNode* left = pq.top();
        pq.pop();
        HuffmanNode* right = pq.top();
        pq.pop();

        // 创建新节点
        HuffmanNode* parent = new HuffmanNode(left->weight + right->weight);
        parent->left = left;
        parent->right = right;

        // 将新节点加入优先队列
        pq.push(parent);

        // 记录当前状态 - 需要将优先队列中的元素复制到vector中
        SimpleVector<HuffmanNode*> currentNodes;

        // 创建一个临时优先队列来复制当前状态
        SimplePriorityQueue<HuffmanNode*, CompareHuffmanNode> tempPQ;

        // 手动复制优先队列的内容
        SimpleVector<HuffmanNode*> tempNodes;
        int originalSize = pq.size();

        // 将原队列的内容转移到临时向量
        for (int i = 0; i < originalSize; ++i) {
            tempNodes.push_back(pq.top());
            pq.pop();
        }

        // 重新构建原队列和临时队列
        for (int i = 0; i < tempNodes.size(); ++i) {
            pq.push(tempNodes[i]);
            tempPQ.push(tempNodes[i]);
            currentNodes.push_back(tempNodes[i]);
        }

        recordBuildStep(currentNodes);
    }

    m_root = pq.top();
}

void HuffmanTreeWindow::generateHuffmanCodes(HuffmanNode* node, const QString& code)
{
    if (node == nullptr) return;

    if (node->character != '\0') {
        m_huffmanCodes.insert(node->character, code);
    }

    generateHuffmanCodes(node->left, code + "0");
    generateHuffmanCodes(node->right, code + "1");
}

int HuffmanTreeWindow::getTreeHeight(HuffmanNode* node)
{
    if (node == nullptr) return 0;
    return 1 + max(getTreeHeight(node->left), getTreeHeight(node->right));
}

void HuffmanTreeWindow::onInputWeights()
{
    InputWeightsDialog dialog(this);
    if (dialog.exec() == QDialog::Accepted) {
        QString input = dialog.getWeights();
        if (input.isEmpty()) return;

        clearTree(m_root);
        m_root = nullptr;
        m_frequencies.clear();
        m_huffmanCodes.clear();
        m_buildSteps.clear();
        m_currentBuildStep = 0;

        QStringList numbers = input.split(' ', Qt::SkipEmptyParts);

        char ch = 'A';
        for (const QString& numStr : numbers) {
            bool ok;
            int weight = numStr.toInt(&ok);
            if (ok && weight > 0) {
                m_frequencies.push_back(CharIntPair(ch, weight));
                ch++;
                if (ch > 'Z') ch = 'a'; // 如果超过26个大写字母，继续使用小写字母
            }
        }

        if (!m_frequencies.empty()) {
            buildHuffmanTree();
            generateHuffmanCodes(m_root, "");
            updateDisplay();
            QMessageBox::information(this, "构建成功", "哈夫曼树构建完成，使用上一步/下一步查看构建过程");
        } else {
            QMessageBox::warning(this, "输入错误", "请输入有效的正整数权重");
        }
    }
}

void HuffmanTreeWindow::onGenerateCodes()
{
    if (m_root == nullptr) {
        QMessageBox::warning(this, "生成失败", "请先构建哈夫曼树");
        return;
    }

    m_huffmanCodes.clear();
    generateHuffmanCodes(m_root, "");
    updateDisplay();
    QMessageBox::information(this, "生成成功", "哈夫曼编码生成完成");
}

void HuffmanTreeWindow::onEncodeText()
{
    EncodeDecodeDialog dialog(this, true);
    if (dialog.exec() == QDialog::Accepted) {
        QString input = dialog.getInput();
        if (input.isEmpty()) return;

        if (m_huffmanCodes.contains(input[0].toLatin1()) == false) {
            QMessageBox::warning(this, "编码失败", "请先生成哈夫曼编码");
            return;
        }

        QString encoded;
        for (QChar ch : input) {
            if (m_huffmanCodes.contains(ch.toLatin1())) {
                encoded += m_huffmanCodes[ch.toLatin1()];
            } else {
                QMessageBox::warning(this, "编码失败", QString("字符 '%1' 没有对应的哈夫曼编码").arg(ch));
                return;
            }
        }

        m_display->setText(m_display->toPlainText() + QString("\n\n编码结果:\n%1").arg(encoded));
        QMessageBox::information(this, "编码结果", QString("编码: %1").arg(encoded));
    }
}

void HuffmanTreeWindow::onDecodeText()
{
    EncodeDecodeDialog dialog(this, false);
    if (dialog.exec() == QDialog::Accepted) {
        QString input = dialog.getInput();
        if (input.isEmpty()) return;

        if (m_root == nullptr) {
            QMessageBox::warning(this, "解码失败", "请先构建哈夫曼树");
            return;
        }

        QString decoded;
        HuffmanNode* current = m_root;

        for (QChar bit : input) {
            if (bit == '0') {
                current = current->left;
            } else if (bit == '1') {
                current = current->right;
            } else {
                QMessageBox::warning(this, "解码失败", "输入包含非二进制字符");
                return;
            }

            if (current == nullptr) {
                QMessageBox::warning(this, "解码失败", "无效的编码序列");
                return;
            }

            if (current->character != '\0') {
                decoded += current->character;
                current = m_root;
            }
        }

        if (current != m_root) {
            QMessageBox::warning(this, "解码失败", "编码序列不完整");
            return;
        }

        m_display->setText(m_display->toPlainText() + QString("\n\n解码结果:\n%1").arg(decoded));
        QMessageBox::information(this, "解码结果", QString("解码: %1").arg(decoded));
    }
}

void HuffmanTreeWindow::onNextStep()
{
    if (m_currentBuildStep < m_buildSteps.size() - 1) {
        m_currentBuildStep++;
        updateDisplay();
    }
}

void HuffmanTreeWindow::onPrevStep()
{
    if (m_currentBuildStep > 0) {
        m_currentBuildStep--;
        updateDisplay();
    }
}

void HuffmanTreeWindow::onAutoPlay()
{
    if (m_autoPlayTimer->isActive()) {
        m_autoPlayTimer->stop();
        m_autoPlayBtn->setText("自动播放");
    } else {
        m_autoPlayTimer->start(1000); // 1秒一步
        m_autoPlayBtn->setText("停止播放");
    }
}

void HuffmanTreeWindow::onClear()
{
    // 停止自动播放定时器
    if (m_autoPlayTimer->isActive()) {
        m_autoPlayTimer->stop();
        m_autoPlayBtn->setText("自动播放");
    }

    clearTree(m_root);
    m_root = nullptr;
    m_frequencies.clear();
    m_huffmanCodes.clear();
    m_buildSteps.clear();
    m_currentBuildStep = 0;

    // 重置可视化部件
    m_visualizationWidget->setRoot(nullptr);
    m_visualizationWidget->setBuildSteps(QVector<QVector<HuffmanNode*>>());

    updateDisplay();
    QMessageBox::information(this, "清空成功", "哈夫曼树已清空");
}
